package com.neudu.yiyang.controller;


import com.neudu.yiyang.commons.JSONReturn;
import com.neudu.yiyang.service.MenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class MenuController {
    @Autowired
    private JSONReturn jsonReturn;
    @Autowired
    private MenuService menuService;

    //获取菜单：当前项目是角色决定菜单，所以查询条件是角色id
    @RequestMapping("get_menus")
    public String getMenusByRoleId(Integer roleid){
        try {
            System.out.println("111111111111111"+roleid);
            return jsonReturn.returnSuccess(menuService.getByroleid(roleid));
        } catch (Exception e){
            e.printStackTrace();
            return jsonReturn.returnError(e.getMessage());
        }
    }

}
